package com.molin.IOtest.charstreamTest;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class lianxi02 {
    public static void main(String[] args) throws IOException {
        String path="D:\\IdeaProjects\\BasicCode\\mIdeaTest\\src\\com\\molin\\IOtest\\charstreamTest\\my.cnf";
        FileReader fr=new FileReader(path);

        char[] chars= new char[1024];
        int len;
        //将读取到的数据读入chars数组中，返回读取的长度，如果到结尾返回-1
        while ((len=fr.read(chars))!=-1){
            System.out.print(new String(chars,0,len));
        }
    }
}
